import { nextTick, Ref } from "vue";

export const useTree = (treeRef: Ref) => {
  const getCheckedKeys = async () => {
    await nextTick();
    return treeRef.value.getCheckedKeys();
  };
  const setCheckedKeys = async (keys: String[] | Number[], leafOnly?: Boolean) => {
    await nextTick();
    return treeRef.value.setCheckedKeys(keys, leafOnly);
  };
  return { getCheckedKeys, setCheckedKeys };
};
